package ceshi;

import java.lang.reflect.Method;

class SampleClass {
    public void method1(String str, int num) {
        // 方法实现
    }

    public int method2(double dbl, boolean flag) {
        // 方法实现
        return 0;
    }
}

public class CheckMethodParameters {
    public static void main(String[] args) throws Exception {
        Class<?> clazz = SampleClass.class;

        Method method1 = clazz.getMethod("method1", String.class, int.class);
        Class<?>[] parameterTypes1 = method1.getParameterTypes();
        System.out.println("Method1 parameter types:");
        for (Class<?> paramType : parameterTypes1) {
            System.out.println(paramType.getName());
        }

        Method method2 = clazz.getMethod("method2", double.class, boolean.class);
        Class<?>[] parameterTypes2 = method2.getParameterTypes();
        System.out.println("Method2 parameter types:");
        for (Class<?> paramType : parameterTypes2) {
            System.out.println(paramType.getName());
        }
    }
}